﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Zoo.Cat.Domain.Entities.Links;
using Zoo.Infrastructure.Data.Core;
using Zoo.Infrastructure.Caching;
using Zoo.Infrastructure.Events;

namespace Zoo.Cat.Application.Links
{
    public class LinkService:ILinkService
    {
        #region Fields
        private readonly IRepository<Link> _linkRepository;
        private readonly ICacheManager _cacheManager;
        private readonly IEventPublisher _eventPublisher;
        #endregion

        #region Ctor
        public LinkService(IRepository<Link> linkRepository,
            ICacheManager cacheManager, IEventPublisher eventPublisher)
        {
            this._linkRepository = linkRepository;
            this._cacheManager = cacheManager;
            this._eventPublisher = eventPublisher;
        }
        #endregion

        #region Method
        IQueryable<Link> ILinkService.GetLinkByArea(string areacode)
        {
            var list = from item in _linkRepository.Table
                       where item.AreaCode == areacode
                       select item;

            return list;
        }
        #endregion


        IQueryable<Link> ILinkService.GetLinkAll()
        {
            var list = from item in _linkRepository.Table
                       select item;

            return list;
        }

    }
}
